﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using MobileSales.Model.Tasks;
using System.ServiceModel.Web;

namespace MobileSales.Server.RestServices
{
    [ServiceContract]
    public interface ITaskServiceREST
    {        
        #region Schedule management

        [OperationContract]
        [WebGet(BodyStyle = WebMessageBodyStyle.Bare,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                UriTemplate = "GetScheduleList/{employeeId}")]
        IEnumerable<Schedule> GetScheduleList(string employeeId);

        [OperationContract]
        [WebGet(BodyStyle = WebMessageBodyStyle.Bare,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                UriTemplate = "GetSchedule/{scheduleId}")]
        Schedule GetSchedule(string scheduleId);

        [OperationContract]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                Method = "POST",
                UriTemplate = "GetScheduleByDate")]
        Schedule GetScheduleByDate(int employeeId, string date);

        [OperationContract]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                Method = "POST",
                UriTemplate = "StartSchedule")]
        void StartSchedule(int scheduleId, double? latitude, double? longitude);

        [OperationContract]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                Method = "POST",
                UriTemplate = "EndSchedule")]
        void EndSchedule(int scheduleId, double? latitude, double? longitude);
        #endregion

        #region Task management

        [OperationContract]
        [WebGet(BodyStyle = WebMessageBodyStyle.Bare,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                UriTemplate = "GetTask/{taskId}")]
        Task GetTask(string taskId);

        [OperationContract]
        [WebGet(BodyStyle = WebMessageBodyStyle.Bare,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                UriTemplate = "GetCyclicTask/{taskId}")]
        CyclicTask GetCyclicTask(string taskId);

        [OperationContract]
        [WebGet(BodyStyle = WebMessageBodyStyle.Bare,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                UriTemplate = "GetTaskList/{scheduleId}")]
        IEnumerable<Task> GetTaskList(string scheduleId);

        [OperationContract]
        [WebGet(BodyStyle = WebMessageBodyStyle.Bare,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                UriTemplate = "GetCyclicTaskList/{employeeId}")]
        IEnumerable<CyclicTask> GetCyclicTaskList(string employeeId);

        [OperationContract]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                Method = "POST",
                UriTemplate = "StoreTask")]
        void StoreTask(Task task, int employeeId);

        [OperationContract]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.Bare,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                Method = "POST",
                UriTemplate = "StoreCyclicTask")]
        void StoreCyclicTask(CyclicTask task);

        [OperationContract]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                Method = "POST",
                UriTemplate = "UpdateTaskStatus")]
        void UpdateTaskStatus(int taskId, int taskStatus);

        [OperationContract]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                Method = "POST",
                UriTemplate = "StartTask")]
        void StartTask(int taskId, int statusId, double? latitude, double? longitude);

        [OperationContract]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                Method = "POST",
                UriTemplate = "EndTask")]
        void EndTask(int taskId, int statusId, double? latitude, double? longitude);
        #endregion

        #region Task status management
        [OperationContract]
        [WebGet(BodyStyle = WebMessageBodyStyle.Bare,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                UriTemplate = "GetTaskStatusList")]
        IEnumerable<TaskStatus> GetTaskStatusList();
        [OperationContract]
        [WebGet(BodyStyle = WebMessageBodyStyle.Bare,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                UriTemplate = "GetTaskStatus/{taskStatusId}")]
        TaskStatus GetTaskStatus(string taskStatusId);
        #endregion

        #region Task type management
        [OperationContract]
        [WebGet(BodyStyle = WebMessageBodyStyle.Bare,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                UriTemplate = "GetTaskTypeList")]
        IEnumerable<TaskType> GetTaskTypeList();

        [OperationContract]
        [WebGet(BodyStyle = WebMessageBodyStyle.Bare,
                RequestFormat = WebMessageFormat.Json,
                ResponseFormat = WebMessageFormat.Json,
                UriTemplate = "GetTaskType/{taskTypeId}")]
        TaskType GetTaskType(string taskTypeId);
        #endregion
    }
}
